{% load i18n %}
<style type="text/css">    
    @import "{{ CMS_MEDIA_URL }}css/toolbar.css";
</style>
<script type="text/javascript" charset="utf-8">
    //<![CDATA[
    // When jQuery is sourced, it's going to overwrite whatever might be in the
    // '$' variable, so store a reference of it in a temporary variable...
    var _$ = window.$;
    if (typeof jQuery == 'undefined') {
        var jquery_url = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
        document.write(unescape('%3Cscript src="' + jquery_url + '" type="text/javascript"%3E%3C/script%3E'));
    }
    //]]>
</script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/lib/jquery.cookie.js"></script> 
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/lib/jquery.backgroundposition.js"></script> 
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/tools.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/lib/jquery.nyroModal-1.6.2.pack.js"></script>
<script type="text/javascript" charset="utf-8">
    //<![CDATA[
    // dynamic variables for the toolbar js file
    var placeholder_data = {{ placeholder_data }};
    var page_is_defined = {% if page %}true{% else %}false{% endif %};
    var translations = {
        move_slot: "{% trans 'Move to %(name)s' %}",
        question: "{% trans "Are you sure you want to delete this plugin?" %}"
    };
    var urls = {
        cms_page_move_plugin: "{% url admin:cms_page_move_plugin %}",
        cms_page_changelist: "{% url admin:cms_page_changelist %}",              
        cms_page_change_template: {% if page %}"{% url admin:cms_page_change_template page.pk %}"{% else %}null{% endif %},
        cms_page_add_plugin: "{% url admin:cms_page_add_plugin %}",
        cms_page_remove_plugin: "{% url admin:cms_page_remove_plugin %}",
        cms_page_move_plugin: "{% url admin:cms_page_move_plugin %}"
    }
    //]]>
</script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/toolbar.js"></script>
<script type="text/javascript" charset="utf-8">
    //<![CDATA[
    // Now that jQuery is done loading, put the '$' variable back to what it was...
    var $ = _$;
    //]]>
</script>

<div id="cms_toolbar_mini">
    <a href="#" id="cms_toolbar_openbutton" class="cms_toolbar_button"><span><strong>Open</strong></span></a>
</div>
<div id="cms_toolbar" class="cms_toolbar cms_toolbar_editmode_toggle_{% if edit %}on{% else %}off{% endif%}">
    <div id="cms_toolbar_col1">
        <a href="http://www.django-cms.org/" id="cms_toolbar_logo"><span>django CMS</span></a>
        {% if auth %}
            {% if page %}
            <div id="cms_toolbar_editmode_toggle">
                <span>{% trans "Edit mode" %}</span>
                <a id="cms_toolbar_edit_button_{% if edit %}on{% else %}off{% endif%}" href="#">toggle</a>
            </div>
            {% endif %}
            {% if page.last_page_states %}
            <div id="cms_toolbar_statusbar">
                <div>
                    <span>{% trans "Status" %}:</span>
                    <em>
                        {% for state in page.last_page_states %}                    
                            {{ state.get_action_display }}    
                        {% endfor %}                
                    </em>
                </div>
            </div>        
            {% endif %}
        {% else %}
        <form method="post" id="cms_toolbar_loginform" {% if auth_error %}class="cms_toolbar_error"{% endif %}>{% csrf_token %}
            <label for="cms_username">{% trans "Username" %}</label>
            <input type="text" name="cms_username" class="cms_textinput"></input>
            <label for="cms_password">{% trans "Password" %}</label>
            <input type="password" name="cms_password" class="cms_textinput"></input>
            <input type="submit" name="submit" value="{% trans "login" %}" class="cms_submit"></input>
            <a href="#" class="cms_toolbar_button"><span>{% trans "login" %}</span></a>        
        </form>
        {% endif %}    
    </div>
    
    <div id="cms_toolbar_col2">
        {% if moderator_should_approve and has_moderate_permission and auth %}<a id="cms_toolbar_approvebutton" href="{% url admin:cms_page_approve_page page.pk %}" class="icon approve cms_toolbar_button" title="{% trans 'Approve directly' %}">
            <span class="state">{{ page_moderator_state.label }}</span>
        </a>{% endif %}
        <!-- a href="#" id="cms_toolbar_savebutton" class="cms_toolbar_button"><span>Save</span></a-->
        {% if auth and has_change_permission %}
        <div id="cms_toolbar_templatebutton" class="cms_toolbar_templatebutton cms_toolbar_button cms_toolbar_submenubutton"><span><strong>{% trans "Template" %}</strong><em>arrow</em></span>        
            <ul id="cms_toolbar_template_menu" class="cms_toolbar_submenu">
                {% for template in templates %}
                <li class="{% ifequal template.0 page.template %}selected {% endifequal %}{% if forloop.first %}first{% endif %}{% if forloop.last %}last{% endif %}"><a href="#{{ template.0 }}">{{ template.1 }}</a></li>
                {% endfor %}
            </ul>
        </div>
        {% endif %}
        {% if auth %}
        <div id="cms_toolbar_pagebutton" class="cms_toolbar_pagebutton cms_toolbar_button cms_toolbar_submenubutton"><span><strong>Page</strong><em>arrow</em></span>        
            <ul id="cms_toolbar_settings_menu" class="cms_toolbar_submenu">                
                <li class="first"><a href="{% url admin:cms_page_changelist %}"><span class="cms_toolbar_icon_move">{% trans "move" %}</span>{% trans "Move/add Pages" %}</a></li>
                {% if has_add_page_permission %}
                <li><a href="{% url admin:cms_page_add %}?target={{ page.pk }}&position=last-child"><span class="cms_toolbar_icon_add_child">{% trans "add child" %}</span>{% trans "Add child page" %}</a></li>
                <li><a href="{% url admin:cms_page_add %}?{% if page.parent_id %}target={{ page.parent_id }}&position=last-child{% endif %}"><span class="cms_toolbar_icon_add_sibling">{% trans "add sibling" %}</span>{% trans "Add sibling page" %}</a></li>
                {% endif %}
                {% if has_delete_permission %}<li class="last"><a href="{% url admin:cms_page_delete page.pk %}"><span class="cms_toolbar_icon_delete">{% trans "delete" %}</span>{% trans "Delete Page" %}</a></li>{% endif %}
            </ul>
        </div>
        {% endif %}
        <div id="cms_toolbar_settingsbutton" class="cms_toolbar_settingsbutton cms_toolbar_button cms_toolbar_submenubutton"><span><strong>Settings</strong><em>arrow</em></span>        
            <ul id="cms_toolbar_settings_menu" class="cms_toolbar_submenu">                
                <li class="first"><a href="{% url admin:index %}"><span class="cms_toolbar_icon_edit">{% trans "edit" %}</span>{% trans "Site Administration" %}</a></li>
                {% if auth %}
                {% if has_change_permission %}<li><a href="{% url admin:cms_page_change page.pk %}"><span class="cms_toolbar_icon_padeadmin">Icon</span>{% trans "Page Settings" %}</a></li>
                <!--li><a href="#"><span class="cms_toolbar_icon_pageunpublish">Icon</span>Unpublish Page</a></li-->
                <li><a href="{% url admin:cms_page_history page.pk %}"><span class="cms_toolbar_icon_history">{% trans "history" %}</span>{% trans "View History" %}</a></li>
                {% endif %}
                {% endif %}            
            </ul>
        </div>
        {% if auth %}
        <form method="post" id="cms_toolbar_logoutform" {% if auth_error %}class="cms_toolbar_error"{% endif %}>{% csrf_token %}
            <input type="submit" name="logout_submit" value="{% trans "Logout" %}" class="cms_submit" />
            <a href="#" class="cms_toolbar_button" id="cms_toolbar_logoutbutton" ><span><strong>{% trans "Lock" %}</strong><em>{% trans "Logout" %}</em></span></a>
        </form>
        {% endif %}
        <a href="#" id="cms_toolbar_closebutton" class="cms_toolbar_button cms_toolbar_iconbutton"><span><strong>{% trans "Close" %}</strong></span></a>
    </div>

</div>
<div id="cms_toolbar_spacer">&nbsp;</div>

<div id="cms_plugin_overlay">
    <div class="cms_toolbar_plugintools cms_toolbar">
        <div class="cms_toolbar_plugintools_holder">
            <a href="#" class="cms_toolbar_plugin_edit cms_toolbar_button cms_toolbar_iconbutton"><span><strong class="cms_toolbar_icon_edit">{% trans "edit" %}</strong></span></a>            
            
            <a href="#" class="cms_toolbar_upbutton cms_toolbar_button cms_toolbar_iconbutton"><span><strong>{% trans "up" %}</strong></span></a>
            <a href="#" class="cms_toolbar_downbutton cms_toolbar_button cms_toolbar_iconbutton"><span><strong>{% trans "down" %}</strong></span></a>                
            
            <div class="cms_toolbar_settingsbutton cms_toolbar_button cms_toolbar_submenubutton"><span class="cms_toolbar_submenubutton_content"><strong>{% trans "Settings" %}</strong><em>arrow</em></span>        
                <ul class="cms_toolbar_submenu">
                    <li class="last"><a href="#" class="cms_toolbar_plugin_delete"><span class="cms_toolbar_icon_delete">{% trans "delete" %}</span>{% trans "Delete Plugin" %}</a></li>            
                </ul>
            </div>
        </div>    
    </div>
    <div class="cms_plugin_overlay_bg">&nbsp;</div>
</div>
<div id="cms_plugin_overlay2">
    <div class="cms_plugin_overlay_bg">&nbsp;</div>
</div>
